﻿using SX.Core.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;

namespace SX.Core.EventBus.Db
{
    public interface IEventLogService
    {
        /// <summary>
        /// 写入记录到db
        /// </summary>
        /// <param name="event"></param>
        /// <returns></returns>
        Task AddEventTodbAsync(IntegrationEvent @event);      
        /// <summary>
        /// 标记消息为已发送
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns></returns>
        Task MarkEventAsPublishedAsync(string eventId);
        /// <summary>
        /// 标记消息发送失败
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns></returns>
        Task MarkEventAsPublishFailedAsync(string eventId);
        /// <summary>
        /// 标记消息消费成功
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns></returns>
        Task MarkEventAsConsumeSucessAsync(string eventId);
        /// <summary>
        /// 标记消息消费失败
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns></returns>
        Task MarkEventAsConsumeFailedAsync(string eventId);
        /// <summary>
        /// 处理结果
        /// </summary>
        /// <param name="eventId"></param>
        /// <param name="isSuccess"></param>
        /// <param name="messageMark"></param>
        void HandleEventResult(string module,string eventId, bool isSuccess, string messageMark);

    }
}
